class Animal {
    public String name;
    public int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Animal eat() {
        System.out.println(this.name + "正在吃饭");
        return null;
    }
}

class Dog extends Animal {
    public Dog(String name, int age) {
        super(name, age);
    }
    public void bark() {
        System.out.println(this.name + "汪汪叫");
    }
    @Override
    public Dog eat() {
        System.out.println(this.name + "正在吃狗粮");
        return null;
    }
}

public class New {
    public static void main(String[] args) {
        Animal animal = new Dog("lele", 10);
        Dog kek = new Dog("kek", 18);
        Dog kek1 = new Dog("kek", 18);
        Dog kek2 = new Dog("kek", 18);
        animal.eat();
    }

    public static void fun1(Animal animal) {

    }
    public static Animal fun2() {
        Dog dog = new Dog("lele",22);
        return dog;
    }

    public static void main3(String[] args) {
        Dog dog = new Dog("lele", 22);
        fun1(dog);

        Animal animal = fun2();

    }
    public static void main2(String[] args) {
        /*Dog gege = new Dog("gege", 10);
        Animal animal = gege;
        //animal这个引用对象 指向了 dog 这个引用对象*/

        Animal animal = new Dog("gege",11);
    }

    public static void main1(String[] args) {
        Dog a = new Dog("hehe",12);
        a.eat();
        a.bark();
        System.out.println("=========");
        /*Animal lala = new Animal("lala", 19);
        lala.eat();
        lala.bark();//这是子类特有方法，只能调用父类自己特有的成员方法或者成员变量*/
    }
}
